N = 100010
M = N * 2

h, e, ne = [-1] * N, [0] * M, [-1] * M
idx = 0
ans = N
st = [False] * N

def add(a: int, b: int) -> None:
    global idx
    e[idx], ne[idx], h[a] = b, h[a], idx
    idx += 1

def dfs(u: int) -> int:
    st[u] = True

    size, sum_ = 0, 0
    i = h[u]
    while i != -1:
        j = e[i]
        if st[j]:
            i = ne[i]
            continue

        s = dfs(j)
        size = max(size, s)
        sum_ += s

        i = ne[i]

    size = max(size, n - sum_ - 1)
    global ans
    ans = min(ans, size)

    return sum_ + 1

n = int(input())
for i in range(n - 1):
    a, b = map(int, input().split())
    add(a, b)
    add(b, a)

dfs(1)

print(ans)
